<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MTB CAT1 Peripheral driver library: Functions</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="IFXCYP_one-line.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">MTB CAT1 Peripheral driver library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__group__keyscan__functions.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Functions<div class="ingroups"><a class="el" href="group__group__keyscan.html">KeyScan      (KeyScan)</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga52e9c93682fa82711dbf1be652033d0d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__keyscan__functions.html#ga52e9c93682fa82711dbf1be652033d0d">Cy_Keyscan_Register_Callback</a> (<a class="el" href="group__group__keyscan__data__structures.html#gabdae0c466fe83ef246af89387c127ee0">cy_cb_keyscan_handle_events_t</a> cbEvents, <a class="el" href="structcy__stc__keyscan__context__t.html">cy_stc_keyscan_context_t</a> *context)</td></tr>
<tr class="memdesc:ga52e9c93682fa82711dbf1be652033d0d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Registers for callback Application has to register for callback for receiving the key press events.  <a href="#ga52e9c93682fa82711dbf1be652033d0d">More...</a><br /></td></tr>
<tr class="separator:ga52e9c93682fa82711dbf1be652033d0d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaee762678f971e88e99b0a7eda63959df"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__keyscan__functions.html#gaee762678f971e88e99b0a7eda63959df">Cy_Keyscan_Init</a> (MXKEYSCAN_Type *base, const <a class="el" href="structcy__stc__ks__config__t.html">cy_stc_ks_config_t</a> *config, <a class="el" href="structcy__stc__keyscan__context__t.html">cy_stc_keyscan_context_t</a> *context)</td></tr>
<tr class="memdesc:gaee762678f971e88e99b0a7eda63959df"><td class="mdescLeft">&#160;</td><td class="mdescRight">Register Context with the driver This Function registers for the event callback and FW FIFO buffer.  <a href="#gaee762678f971e88e99b0a7eda63959df">More...</a><br /></td></tr>
<tr class="separator:gaee762678f971e88e99b0a7eda63959df"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8aed3a9c02150ba94d22f70418b0b34a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__keyscan__functions.html#ga8aed3a9c02150ba94d22f70418b0b34a">Cy_Keyscan_DeInit</a> (MXKEYSCAN_Type *base, <a class="el" href="structcy__stc__keyscan__context__t.html">cy_stc_keyscan_context_t</a> *context)</td></tr>
<tr class="memdesc:ga8aed3a9c02150ba94d22f70418b0b34a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deinit Keyscan.  <a href="#ga8aed3a9c02150ba94d22f70418b0b34a">More...</a><br /></td></tr>
<tr class="separator:ga8aed3a9c02150ba94d22f70418b0b34a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa91f5f9881bd10de8ed971c1e4da5421"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__keyscan__functions.html#gaa91f5f9881bd10de8ed971c1e4da5421">Cy_Keyscan_Enable</a> (MXKEYSCAN_Type *base, <a class="el" href="structcy__stc__keyscan__context__t.html">cy_stc_keyscan_context_t</a> *context)</td></tr>
<tr class="memdesc:gaa91f5f9881bd10de8ed971c1e4da5421"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enable Keyscan.  <a href="#gaa91f5f9881bd10de8ed971c1e4da5421">More...</a><br /></td></tr>
<tr class="separator:gaa91f5f9881bd10de8ed971c1e4da5421"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga902379f72084f0451a131ab7f681add6"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__keyscan__functions.html#ga902379f72084f0451a131ab7f681add6">Cy_Keyscan_Disable</a> (MXKEYSCAN_Type *base, <a class="el" href="structcy__stc__keyscan__context__t.html">cy_stc_keyscan_context_t</a> *context)</td></tr>
<tr class="memdesc:ga902379f72084f0451a131ab7f681add6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disable keyscan Reset's the Keyscan hardware and disables the keyscan hardware.  <a href="#ga902379f72084f0451a131ab7f681add6">More...</a><br /></td></tr>
<tr class="separator:ga902379f72084f0451a131ab7f681add6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2d9772cf7639507551f8719b61ee149a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__keyscan__functions.html#ga2d9772cf7639507551f8719b61ee149a">Cy_Keyscan_EventsPending</a> (MXKEYSCAN_Type *base, bool *eventsPending, <a class="el" href="structcy__stc__keyscan__context__t.html">cy_stc_keyscan_context_t</a> *context)</td></tr>
<tr class="memdesc:ga2d9772cf7639507551f8719b61ee149a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Events pending Return whether any events are in the FW FIFO or not.  <a href="#ga2d9772cf7639507551f8719b61ee149a">More...</a><br /></td></tr>
<tr class="separator:ga2d9772cf7639507551f8719b61ee149a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga112645238ff1a8fbe2babf37ececa928"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__keyscan__functions.html#ga112645238ff1a8fbe2babf37ececa928">Cy_Keyscan_GetNextEvent</a> (MXKEYSCAN_Type *base, <a class="el" href="structcy__stc__key__event.html">cy_stc_key_event</a> *event, <a class="el" href="structcy__stc__keyscan__context__t.html">cy_stc_keyscan_context_t</a> *context)</td></tr>
<tr class="memdesc:ga112645238ff1a8fbe2babf37ececa928"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get next event from FW FIFO.  <a href="#ga112645238ff1a8fbe2babf37ececa928">More...</a><br /></td></tr>
<tr class="separator:ga112645238ff1a8fbe2babf37ececa928"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab15fd633e448e5f75ff3f3a7880a9670"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__keyscan__functions.html#gab15fd633e448e5f75ff3f3a7880a9670">Cy_Keyscan_SetInterruptMask</a> (MXKEYSCAN_Type *base, uint32_t mask)</td></tr>
<tr class="memdesc:gab15fd633e448e5f75ff3f3a7880a9670"><td class="mdescLeft">&#160;</td><td class="mdescRight">Setup interrupt source to be accepted.  <a href="#gab15fd633e448e5f75ff3f3a7880a9670">More...</a><br /></td></tr>
<tr class="separator:gab15fd633e448e5f75ff3f3a7880a9670"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7f5d1d2ed0c2b0098be1b8a7e334a901"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__keyscan__functions.html#ga7f5d1d2ed0c2b0098be1b8a7e334a901">Cy_Keyscan_GetInterruptMask</a> (MXKEYSCAN_Type *base, uint32_t *mask)</td></tr>
<tr class="memdesc:ga7f5d1d2ed0c2b0098be1b8a7e334a901"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return interrupt mask setting.  <a href="#ga7f5d1d2ed0c2b0098be1b8a7e334a901">More...</a><br /></td></tr>
<tr class="separator:ga7f5d1d2ed0c2b0098be1b8a7e334a901"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaafe690c5c55275e002675833358efc71"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__keyscan__functions.html#gaafe690c5c55275e002675833358efc71">Cy_Keyscan_GetInterruptMaskedStatus</a> (MXKEYSCAN_Type *base, uint32_t *status)</td></tr>
<tr class="memdesc:gaafe690c5c55275e002675833358efc71"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return interrupt masked status.  <a href="#gaafe690c5c55275e002675833358efc71">More...</a><br /></td></tr>
<tr class="separator:gaafe690c5c55275e002675833358efc71"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0d19ff8bef185f26261346665243b72e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__keyscan__functions.html#ga0d19ff8bef185f26261346665243b72e">Cy_Keyscan_GetInterruptStatus</a> (MXKEYSCAN_Type *base, uint32_t *status)</td></tr>
<tr class="memdesc:ga0d19ff8bef185f26261346665243b72e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return interrupt raw status.  <a href="#ga0d19ff8bef185f26261346665243b72e">More...</a><br /></td></tr>
<tr class="separator:ga0d19ff8bef185f26261346665243b72e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab0697bc91ec30ec625080f2e36d8f76f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__keyscan__functions.html#gab0697bc91ec30ec625080f2e36d8f76f">Cy_Keyscan_ClearInterrupt</a> (MXKEYSCAN_Type *base, uint32_t mask)</td></tr>
<tr class="memdesc:gab0697bc91ec30ec625080f2e36d8f76f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clear interrupt status.  <a href="#gab0697bc91ec30ec625080f2e36d8f76f">More...</a><br /></td></tr>
<tr class="separator:gab0697bc91ec30ec625080f2e36d8f76f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac0949bdeeec1076c259f327b5be4766c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__keyscan__functions.html#gac0949bdeeec1076c259f327b5be4766c">Cy_Keyscan_Interrupt_Handler</a> (MXKEYSCAN_Type *base, <a class="el" href="structcy__stc__keyscan__context__t.html">cy_stc_keyscan_context_t</a> *context)</td></tr>
<tr class="memdesc:gac0949bdeeec1076c259f327b5be4766c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Handler for keyscan interrupts.  <a href="#gac0949bdeeec1076c259f327b5be4766c">More...</a><br /></td></tr>
<tr class="separator:gac0949bdeeec1076c259f327b5be4766c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8162b233f6c5454d08ff7edfd1ed7025"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__keyscan__functions.html#ga8162b233f6c5454d08ff7edfd1ed7025">Cy_Keyscan_FlushEvents</a> (MXKEYSCAN_Type *base, <a class="el" href="structcy__stc__keyscan__context__t.html">cy_stc_keyscan_context_t</a> *context)</td></tr>
<tr class="memdesc:ga8162b233f6c5454d08ff7edfd1ed7025"><td class="mdescLeft">&#160;</td><td class="mdescRight">Flush events from HW FIFO.  <a href="#ga8162b233f6c5454d08ff7edfd1ed7025">More...</a><br /></td></tr>
<tr class="separator:ga8162b233f6c5454d08ff7edfd1ed7025"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8019cb06088df4965c389a7a10cae05e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__keyscan__functions.html#ga8019cb06088df4965c389a7a10cae05e">Cy_Keyscan_EnableGhostDetection</a> (MXKEYSCAN_Type *base)</td></tr>
<tr class="memdesc:ga8019cb06088df4965c389a7a10cae05e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enables Ghost detection.  <a href="#ga8019cb06088df4965c389a7a10cae05e">More...</a><br /></td></tr>
<tr class="separator:ga8019cb06088df4965c389a7a10cae05e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga84e9a47942e53502616d6c87fdd2035c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__keyscan__functions.html#ga84e9a47942e53502616d6c87fdd2035c">Cy_Keyscan_DisableGhostDetection</a> (MXKEYSCAN_Type *base)</td></tr>
<tr class="memdesc:ga84e9a47942e53502616d6c87fdd2035c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disables Ghost detection.  <a href="#ga84e9a47942e53502616d6c87fdd2035c">More...</a><br /></td></tr>
<tr class="separator:ga84e9a47942e53502616d6c87fdd2035c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gadd708d5c9a895b841deef7f473c41276"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__keyscan__functions.html#gadd708d5c9a895b841deef7f473c41276">Cy_Keyscan_EnableClockStayOn</a> (MXKEYSCAN_Type *base)</td></tr>
<tr class="memdesc:gadd708d5c9a895b841deef7f473c41276"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enables Clock Stay On Clock to the IP is always enabled.  <a href="#gadd708d5c9a895b841deef7f473c41276">More...</a><br /></td></tr>
<tr class="separator:gadd708d5c9a895b841deef7f473c41276"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga61f8551b923bc07a0a0646865b94d3cf"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__keyscan__functions.html#ga61f8551b923bc07a0a0646865b94d3cf">Cy_Keyscan_DisableClockStayOn</a> (MXKEYSCAN_Type *base)</td></tr>
<tr class="memdesc:ga61f8551b923bc07a0a0646865b94d3cf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disables Clock Stay On When there is no activity detected the clock to the Keyscan is gated off.  <a href="#ga61f8551b923bc07a0a0646865b94d3cf">More...</a><br /></td></tr>
<tr class="separator:ga61f8551b923bc07a0a0646865b94d3cf"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga52e9c93682fa82711dbf1be652033d0d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga52e9c93682fa82711dbf1be652033d0d">&#9670;&nbsp;</a></span>Cy_Keyscan_Register_Callback()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> Cy_Keyscan_Register_Callback </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__keyscan__data__structures.html#gabdae0c466fe83ef246af89387c127ee0">cy_cb_keyscan_handle_events_t</a>&#160;</td>
          <td class="paramname"><em>cbEvents</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__keyscan__context__t.html">cy_stc_keyscan_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Registers for callback Application has to register for callback for receiving the key press events. </p>
<p>In the interrupt handler data from HW FIFO is copied to FW FIFO and application is notified to get the data using this callback function.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">cbEvents</td><td>Pointer to the callback function.</td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">context</td><td>Pointer to the context.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">Refer</td><td><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line">    <span class="keywordflow">if</span>(<a class="code" href="group__group__keyscan__enums.html#gga63db7add05b9f273c43aac216af16d4bad0ab5c35021d0615b1063492c23e1841">CY_KEYSCAN_SUCCESS</a> != <a class="code" href="group__group__keyscan__functions.html#ga52e9c93682fa82711dbf1be652033d0d">Cy_Keyscan_Register_Callback</a>(key_detected_callback, &amp;context))</div><div class="line">    {</div><div class="line">        <span class="comment">/* Insert error handling */</span></div><div class="line">    }</div></div><!-- fragment --> Registers for callback Application has to register for callback for receiving the key press events.</dd></dl>
<p>[in] cbEvents Pointer to the callback function.</p>
<p>[in] context Pointer to the context. </p>

</div>
</div>
<a id="gaee762678f971e88e99b0a7eda63959df"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaee762678f971e88e99b0a7eda63959df">&#9670;&nbsp;</a></span>Cy_Keyscan_Init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> Cy_Keyscan_Init </td>
          <td>(</td>
          <td class="paramtype">MXKEYSCAN_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structcy__stc__ks__config__t.html">cy_stc_ks_config_t</a> *&#160;</td>
          <td class="paramname"><em>config</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__keyscan__context__t.html">cy_stc_keyscan_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Register Context with the driver This Function registers for the event callback and FW FIFO buffer. </p>
<dl class="section pre"><dt>Precondition</dt><dd>The Application must configure corresponding keyscan pins according to requirements and settings of keyscan instance.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">base</td><td>Pointer to KeyScan instance register area </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">config</td><td>KeyScan module configuration. See <a class="el" href="structcy__stc__ks__config__t.html" title="keyscan configuration These settings are per KEYSCAN instance. ">cy_stc_ks_config_t</a>. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">context</td><td>Pointer to the context.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">Refer</td><td><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line"></div><div class="line">    <a class="code" href="structcy__stc__ks__config__t.html">cy_stc_ks_config_t</a> keyscan_config =</div><div class="line">    {</div><div class="line">        .<a class="code" href="structcy__stc__ks__config__t.html#a4ea353cdc39783c95c29df47731f4ac1">macroDownDebCnt</a> = 3u,  </div><div class="line">        .macroUpDebCnt = 3u,    </div><div class="line">        .microDebCnt = 3u,      </div><div class="line">        .noofRows = 8u,         </div><div class="line">        .noofColumns = 20u,     </div><div class="line">        .ghostEnable = <span class="keyword">true</span>,    </div><div class="line">        .cpuWakeupEnable = <span class="keyword">true</span>,</div><div class="line">        .clkStayOn = <span class="keyword">true</span>       </div><div class="line">    };</div><div class="line"></div><div class="line">    <a class="code" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> status;</div><div class="line">    status = <a class="code" href="group__group__keyscan__functions.html#gaee762678f971e88e99b0a7eda63959df">Cy_Keyscan_Init</a>(MXKEYSCAN, &amp;keyscan_config, &amp;context);</div><div class="line">    <span class="keywordflow">if</span>(status != <a class="code" href="group__group__keyscan__enums.html#gga63db7add05b9f273c43aac216af16d4bad0ab5c35021d0615b1063492c23e1841">CY_KEYSCAN_SUCCESS</a>)</div><div class="line">    {</div><div class="line">        <span class="comment">/* Insert error handling */</span></div><div class="line">    }</div></div><!-- fragment --> The Application must configure corresponding keyscan pins according to requirements and settings of keyscan instance.</dd></dl>
<p>[in] base Pointer to KeyScan instance register area [in] config KeyScan module configuration. See <a class="el" href="structcy__stc__ks__config__t.html" title="keyscan configuration These settings are per KEYSCAN instance. ">cy_stc_ks_config_t</a>. [out] context Pointer to the context. </p>

</div>
</div>
<a id="ga8aed3a9c02150ba94d22f70418b0b34a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga8aed3a9c02150ba94d22f70418b0b34a">&#9670;&nbsp;</a></span>Cy_Keyscan_DeInit()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> Cy_Keyscan_DeInit </td>
          <td>(</td>
          <td class="paramtype">MXKEYSCAN_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__keyscan__context__t.html">cy_stc_keyscan_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Deinit Keyscan. </p>
<p>Deinits the Keyscan HW Clear FW FIFO after a HW reset. Restores the control data and enables scans if they were enabled before this function was called.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>[in] Pointer to Keyscan instance register area. </td></tr>
    <tr><td class="paramname">context</td><td>[in] Pointer to the context.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">Refer</td><td><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line">    <a class="code" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> status;</div><div class="line">    status = <a class="code" href="group__group__keyscan__functions.html#ga8aed3a9c02150ba94d22f70418b0b34a">Cy_Keyscan_DeInit</a> (MXKEYSCAN, &amp;context);</div><div class="line">    <span class="keywordflow">if</span>(<a class="code" href="group__group__keyscan__enums.html#gga63db7add05b9f273c43aac216af16d4bad0ab5c35021d0615b1063492c23e1841">CY_KEYSCAN_SUCCESS</a> != status)</div><div class="line">    {</div><div class="line">        <span class="comment">/* Insert error handling */</span></div><div class="line">    }</div></div><!-- fragment --> Deinit Keyscan.</dd></dl>
<p>base [in] Pointer to KEYSCAN instance register area. </p>

</div>
</div>
<a id="gaa91f5f9881bd10de8ed971c1e4da5421"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaa91f5f9881bd10de8ed971c1e4da5421">&#9670;&nbsp;</a></span>Cy_Keyscan_Enable()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> Cy_Keyscan_Enable </td>
          <td>(</td>
          <td class="paramtype">MXKEYSCAN_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__keyscan__context__t.html">cy_stc_keyscan_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Enable Keyscan. </p>
<p>Enables the keyscan hardware.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>[in] Pointer to KeyScan instance register area. </td></tr>
    <tr><td class="paramname">context</td><td>[in] Pointer to the context.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">Refer</td><td><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line">    <span class="keywordflow">if</span>(<a class="code" href="group__group__keyscan__enums.html#gga63db7add05b9f273c43aac216af16d4bad0ab5c35021d0615b1063492c23e1841">CY_KEYSCAN_SUCCESS</a> != <a class="code" href="group__group__keyscan__functions.html#gaa91f5f9881bd10de8ed971c1e4da5421">Cy_Keyscan_Enable</a>(MXKEYSCAN, &amp;context))</div><div class="line">    {</div><div class="line">        <span class="comment">/* Insert error handling */</span></div><div class="line">    }</div></div><!-- fragment --> base [in] Pointer to KeyScan instance register area. context [in] Pointer to the context. </dd></dl>

</div>
</div>
<a id="ga902379f72084f0451a131ab7f681add6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga902379f72084f0451a131ab7f681add6">&#9670;&nbsp;</a></span>Cy_Keyscan_Disable()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> Cy_Keyscan_Disable </td>
          <td>(</td>
          <td class="paramtype">MXKEYSCAN_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__keyscan__context__t.html">cy_stc_keyscan_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Disable keyscan Reset's the Keyscan hardware and disables the keyscan hardware. </p>
<p>When disabled, clock to the keyscan IP is gated.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>[in] Pointer to KeyScan instance register area. </td></tr>
    <tr><td class="paramname">context</td><td>[in] Pointer to the context.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">Refer</td><td><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line">    <span class="keywordflow">if</span>(<a class="code" href="group__group__keyscan__enums.html#gga63db7add05b9f273c43aac216af16d4bad0ab5c35021d0615b1063492c23e1841">CY_KEYSCAN_SUCCESS</a> != <a class="code" href="group__group__keyscan__functions.html#ga902379f72084f0451a131ab7f681add6">Cy_Keyscan_Disable</a>(MXKEYSCAN, &amp;context))</div><div class="line">    {</div><div class="line">        <span class="comment">/* Insert error handling */</span></div><div class="line">    }</div></div><!-- fragment --> Disable keyscan Reset's the Keyscan hardware and disables the keyscan hardware.</dd></dl>
<p>base [in] Pointer to KeyScan instance register area. context [in] Pointer to the context. </p>

</div>
</div>
<a id="ga2d9772cf7639507551f8719b61ee149a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga2d9772cf7639507551f8719b61ee149a">&#9670;&nbsp;</a></span>Cy_Keyscan_EventsPending()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> Cy_Keyscan_EventsPending </td>
          <td>(</td>
          <td class="paramtype">MXKEYSCAN_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool *&#160;</td>
          <td class="paramname"><em>eventsPending</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__keyscan__context__t.html">cy_stc_keyscan_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Events pending Return whether any events are in the FW FIFO or not. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>[in] Pointer to KeyScan instance register area. </td></tr>
    <tr><td class="paramname">context</td><td>[in] Pointer to the context. </td></tr>
    <tr><td class="paramname">eventsPending</td><td>[out] Pointer to the eventsPending, True if events pending and otherwise False.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">Refer</td><td><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line">    <span class="keywordflow">if</span>(<a class="code" href="group__group__keyscan__enums.html#gga63db7add05b9f273c43aac216af16d4bad0ab5c35021d0615b1063492c23e1841">CY_KEYSCAN_SUCCESS</a> != <a class="code" href="group__group__keyscan__functions.html#ga2d9772cf7639507551f8719b61ee149a">Cy_Keyscan_EventsPending</a>(MXKEYSCAN, &amp;events_pending, &amp;context))</div><div class="line">    {</div><div class="line">        <span class="comment">/* Insert error handling */</span></div><div class="line">    }</div></div><!-- fragment --> Events pending Return whether any events are in the FW FIFO or not.</dd></dl>
<p>base [in] Pointer to KeyScan instance register area. context [in] Pointer to the context. eventsPending [out] Pointer to the eventsPending. </p>

</div>
</div>
<a id="ga112645238ff1a8fbe2babf37ececa928"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga112645238ff1a8fbe2babf37ececa928">&#9670;&nbsp;</a></span>Cy_Keyscan_GetNextEvent()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> Cy_Keyscan_GetNextEvent </td>
          <td>(</td>
          <td class="paramtype">MXKEYSCAN_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__key__event.html">cy_stc_key_event</a> *&#160;</td>
          <td class="paramname"><em>event</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__keyscan__context__t.html">cy_stc_keyscan_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get next event from FW FIFO. </p>
<p>Applications have to call <a class="el" href="group__group__keyscan__functions.html#gac0949bdeeec1076c259f327b5be4766c">Cy_Keyscan_Interrupt_Handler</a> from keyscan interrupt handler. After successfully reading from HW FIFO and writing to FW FIFO applications will be notified through the registered callback. Applications to read from the FW FIFO has to call this function in a loop till the return value is CY_KEYSCAN_EVENT_NONE</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>[in] Pointer to KeyScan instance register area. </td></tr>
    <tr><td class="paramname">context</td><td>[in] Pointer to the context. </td></tr>
    <tr><td class="paramname">event</td><td>[out] Pointer to the next event.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">Refer</td><td><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line"><span class="comment">/*</span></div><div class="line"><span class="comment"> ** Applications have to call Cy_Keyscan_Interrupt_Handler function from keyscan interrupt handler.</span></div><div class="line"><span class="comment"> ** Applications will be notified of any key events through the registered callback.</span></div><div class="line"><span class="comment"> ** Applications have to read the events in the callback function by calling Cy_Keyscan_GetNextEvent function in a loop till</span></div><div class="line"><span class="comment"> ** the return value is CY_KEYSCAN_EVENT_NONE.</span></div><div class="line"><span class="comment"> */</span></div><div class="line"><span class="keywordtype">void</span> keyscan_intHandler(<span class="keywordtype">void</span>)</div><div class="line">{</div><div class="line">    <a class="code" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> status;</div><div class="line">    uint32_t int_status;</div><div class="line">    <a class="code" href="group__group__keyscan__functions.html#gaafe690c5c55275e002675833358efc71">Cy_Keyscan_GetInterruptMaskedStatus</a>(MXKEYSCAN, &amp;int_status);</div><div class="line">    <span class="keywordflow">if</span>(0UL != (<a class="code" href="group__group__keyscan__intr__mask__macro.html#gabaf6c48f537039c42f3cd554fbead9ec">MXKEYSCAN_INTR_FIFO_THRESH_DONE</a> &amp; int_status))</div><div class="line">    {</div><div class="line">       status = <a class="code" href="group__group__keyscan__functions.html#gac0949bdeeec1076c259f327b5be4766c">Cy_Keyscan_Interrupt_Handler</a>(MXKEYSCAN, &amp;context);</div><div class="line">       <span class="keywordflow">if</span>(<a class="code" href="group__group__keyscan__enums.html#gga63db7add05b9f273c43aac216af16d4bad0ab5c35021d0615b1063492c23e1841">CY_KEYSCAN_SUCCESS</a> != status)</div><div class="line">       {</div><div class="line">            <span class="comment">// Keyscan interrupt handler failed </span></div><div class="line">       }</div><div class="line">    }</div><div class="line">    <span class="keywordflow">else</span></div><div class="line">    {</div><div class="line">        <a class="code" href="group__group__keyscan__functions.html#gab0697bc91ec30ec625080f2e36d8f76f">Cy_Keyscan_ClearInterrupt</a>(MXKEYSCAN, <a class="code" href="group__group__keyscan__intr__mask__macro.html#ga203e1a386d3c094322980c053cb4d5f9">MXKEYSCAN_INTR_KEY_EDGE_DONE</a>);</div><div class="line">    }</div><div class="line"></div><div class="line">}</div><div class="line"></div><div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> key_detected_callback(<span class="keywordtype">void</span>)</div><div class="line">{</div><div class="line">    <a class="code" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> status;</div><div class="line">    <a class="code" href="structcy__stc__key__event.html">cy_stc_key_event</a> kevent;</div><div class="line">    uint8_t keyCode, scanCycle, upDownFlag;</div><div class="line">    <span class="keywordtype">bool</span> events_pending;</div><div class="line">    <a class="code" href="group__group__keyscan__functions.html#ga2d9772cf7639507551f8719b61ee149a">Cy_Keyscan_EventsPending</a>(MXKEYSCAN, &amp;events_pending, &amp;context);</div><div class="line">    <span class="keywordflow">while</span> (events_pending)</div><div class="line">    {</div><div class="line">        status = <a class="code" href="group__group__keyscan__functions.html#ga112645238ff1a8fbe2babf37ececa928">Cy_Keyscan_GetNextEvent</a>(MXKEYSCAN, &amp;kevent, &amp;context);</div><div class="line">        <span class="keywordflow">if</span>(status != <a class="code" href="group__group__keyscan__enums.html#gga63db7add05b9f273c43aac216af16d4bad0ab5c35021d0615b1063492c23e1841">CY_KEYSCAN_SUCCESS</a>)</div><div class="line">        {</div><div class="line">            <span class="comment">// Keyscan get next event failed </span></div><div class="line">        }</div><div class="line">        <span class="comment">/* Check value of keycode for the corresponding key being pressed</span></div><div class="line"><span class="comment">           Keycode is calculated as ((no of rows * column num) + row num) */</span></div><div class="line">        keyCode = kevent.<a class="code" href="structcy__stc__key__event.html#a380b32448606828dab08e812bc3177f7">keyCode</a>;</div><div class="line">        scanCycle = kevent.<a class="code" href="structcy__stc__key__event.html#a4dfca39b0e4b645e4f4aa3c4ba346dc2">scanCycleFlag</a>;</div><div class="line">        upDownFlag = kevent.<a class="code" href="structcy__stc__key__event.html#a09f7d1c2aeb58ae2e29556a7933c7c79">upDownFlag</a>;</div><div class="line"></div><div class="line">        <span class="keywordflow">if</span>(keyCode == <a class="code" href="group__group__keyscan__enums.html#gga3e52483d024a86b66d31e61c83ed4751a5226620ddbc8a578dd0de50c7e6f4728">KEYSCAN_KEYCODE_ROLLOVER</a>)</div><div class="line">        {</div><div class="line">            <span class="comment">// ROLLOVER KEY DETECTED</span></div><div class="line">        }</div><div class="line">        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(keyCode == <a class="code" href="group__group__keyscan__enums.html#gga3e52483d024a86b66d31e61c83ed4751a2ef0b0d0f231e64c1eff96564dcf1d9a">KEYSCAN_KEYCODE_END_OF_SCAN_CYCLE</a>)</div><div class="line">        {</div><div class="line">            <span class="comment">// End of Scan Cycle event. Added by driver when an event is occurred in different scan cycle.</span></div><div class="line">            <a class="code" href="group__group__keyscan__functions.html#ga2d9772cf7639507551f8719b61ee149a">Cy_Keyscan_EventsPending</a>(MXKEYSCAN, &amp;events_pending, &amp;context);</div><div class="line">            <span class="keywordflow">continue</span>;</div><div class="line">        }</div><div class="line">        <a class="code" href="group__group__keyscan__functions.html#ga2d9772cf7639507551f8719b61ee149a">Cy_Keyscan_EventsPending</a>(MXKEYSCAN, &amp;events_pending, &amp;context);</div><div class="line">        (void)keyCode;</div><div class="line">        (void)scanCycle;</div><div class="line">        (void)upDownFlag;</div><div class="line">    }</div><div class="line">}</div></div><!-- fragment --> Get next event from FW FIFO.</dd></dl>
<p>base [in] Pointer to KeyScan instance register area. context [in] Pointer to the context. event [out] Pointer to the next event. </p>

</div>
</div>
<a id="gab15fd633e448e5f75ff3f3a7880a9670"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab15fd633e448e5f75ff3f3a7880a9670">&#9670;&nbsp;</a></span>Cy_Keyscan_SetInterruptMask()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> Cy_Keyscan_SetInterruptMask </td>
          <td>(</td>
          <td class="paramtype">MXKEYSCAN_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>mask</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Setup interrupt source to be accepted. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>[in] Pointer to KeyScan instance register area. </td></tr>
    <tr><td class="paramname">mask</td><td>[in] The mask with the OR of the interrupt source to be accepted. See <a class="el" href="group__group__keyscan__intr__mask__macro.html">KeyScan ALL interrupt mask definition</a> for the set of constants.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">Refer</td><td><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line"><span class="comment">/*</span></div><div class="line"><span class="comment"> ** Applications have to call Cy_Keyscan_Interrupt_Handler function from keyscan interrupt handler.</span></div><div class="line"><span class="comment"> ** Applications will be notified of any key events through the registered callback.</span></div><div class="line"><span class="comment"> ** Applications have to read the events in the callback function by calling Cy_Keyscan_GetNextEvent function in a loop till</span></div><div class="line"><span class="comment"> ** the return value is CY_KEYSCAN_EVENT_NONE.</span></div><div class="line"><span class="comment"> */</span></div><div class="line"><span class="keywordtype">void</span> keyscan_intHandler(<span class="keywordtype">void</span>)</div><div class="line">{</div><div class="line">    <a class="code" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> status;</div><div class="line">    uint32_t int_status;</div><div class="line">    <a class="code" href="group__group__keyscan__functions.html#gaafe690c5c55275e002675833358efc71">Cy_Keyscan_GetInterruptMaskedStatus</a>(MXKEYSCAN, &amp;int_status);</div><div class="line">    <span class="keywordflow">if</span>(0UL != (<a class="code" href="group__group__keyscan__intr__mask__macro.html#gabaf6c48f537039c42f3cd554fbead9ec">MXKEYSCAN_INTR_FIFO_THRESH_DONE</a> &amp; int_status))</div><div class="line">    {</div><div class="line">       status = <a class="code" href="group__group__keyscan__functions.html#gac0949bdeeec1076c259f327b5be4766c">Cy_Keyscan_Interrupt_Handler</a>(MXKEYSCAN, &amp;context);</div><div class="line">       <span class="keywordflow">if</span>(<a class="code" href="group__group__keyscan__enums.html#gga63db7add05b9f273c43aac216af16d4bad0ab5c35021d0615b1063492c23e1841">CY_KEYSCAN_SUCCESS</a> != status)</div><div class="line">       {</div><div class="line">            <span class="comment">// Keyscan interrupt handler failed </span></div><div class="line">       }</div><div class="line">    }</div><div class="line">    <span class="keywordflow">else</span></div><div class="line">    {</div><div class="line">        <a class="code" href="group__group__keyscan__functions.html#gab0697bc91ec30ec625080f2e36d8f76f">Cy_Keyscan_ClearInterrupt</a>(MXKEYSCAN, <a class="code" href="group__group__keyscan__intr__mask__macro.html#ga203e1a386d3c094322980c053cb4d5f9">MXKEYSCAN_INTR_KEY_EDGE_DONE</a>);</div><div class="line">    }</div><div class="line"></div><div class="line">}</div><div class="line"></div><div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> key_detected_callback(<span class="keywordtype">void</span>)</div><div class="line">{</div><div class="line">    <a class="code" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> status;</div><div class="line">    <a class="code" href="structcy__stc__key__event.html">cy_stc_key_event</a> kevent;</div><div class="line">    uint8_t keyCode, scanCycle, upDownFlag;</div><div class="line">    <span class="keywordtype">bool</span> events_pending;</div><div class="line">    <a class="code" href="group__group__keyscan__functions.html#ga2d9772cf7639507551f8719b61ee149a">Cy_Keyscan_EventsPending</a>(MXKEYSCAN, &amp;events_pending, &amp;context);</div><div class="line">    <span class="keywordflow">while</span> (events_pending)</div><div class="line">    {</div><div class="line">        status = <a class="code" href="group__group__keyscan__functions.html#ga112645238ff1a8fbe2babf37ececa928">Cy_Keyscan_GetNextEvent</a>(MXKEYSCAN, &amp;kevent, &amp;context);</div><div class="line">        <span class="keywordflow">if</span>(status != <a class="code" href="group__group__keyscan__enums.html#gga63db7add05b9f273c43aac216af16d4bad0ab5c35021d0615b1063492c23e1841">CY_KEYSCAN_SUCCESS</a>)</div><div class="line">        {</div><div class="line">            <span class="comment">// Keyscan get next event failed </span></div><div class="line">        }</div><div class="line">        <span class="comment">/* Check value of keycode for the corresponding key being pressed</span></div><div class="line"><span class="comment">           Keycode is calculated as ((no of rows * column num) + row num) */</span></div><div class="line">        keyCode = kevent.<a class="code" href="structcy__stc__key__event.html#a380b32448606828dab08e812bc3177f7">keyCode</a>;</div><div class="line">        scanCycle = kevent.<a class="code" href="structcy__stc__key__event.html#a4dfca39b0e4b645e4f4aa3c4ba346dc2">scanCycleFlag</a>;</div><div class="line">        upDownFlag = kevent.<a class="code" href="structcy__stc__key__event.html#a09f7d1c2aeb58ae2e29556a7933c7c79">upDownFlag</a>;</div><div class="line"></div><div class="line">        <span class="keywordflow">if</span>(keyCode == <a class="code" href="group__group__keyscan__enums.html#gga3e52483d024a86b66d31e61c83ed4751a5226620ddbc8a578dd0de50c7e6f4728">KEYSCAN_KEYCODE_ROLLOVER</a>)</div><div class="line">        {</div><div class="line">            <span class="comment">// ROLLOVER KEY DETECTED</span></div><div class="line">        }</div><div class="line">        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(keyCode == <a class="code" href="group__group__keyscan__enums.html#gga3e52483d024a86b66d31e61c83ed4751a2ef0b0d0f231e64c1eff96564dcf1d9a">KEYSCAN_KEYCODE_END_OF_SCAN_CYCLE</a>)</div><div class="line">        {</div><div class="line">            <span class="comment">// End of Scan Cycle event. Added by driver when an event is occurred in different scan cycle.</span></div><div class="line">            <a class="code" href="group__group__keyscan__functions.html#ga2d9772cf7639507551f8719b61ee149a">Cy_Keyscan_EventsPending</a>(MXKEYSCAN, &amp;events_pending, &amp;context);</div><div class="line">            <span class="keywordflow">continue</span>;</div><div class="line">        }</div><div class="line">        <a class="code" href="group__group__keyscan__functions.html#ga2d9772cf7639507551f8719b61ee149a">Cy_Keyscan_EventsPending</a>(MXKEYSCAN, &amp;events_pending, &amp;context);</div><div class="line">        (void)keyCode;</div><div class="line">        (void)scanCycle;</div><div class="line">        (void)upDownFlag;</div><div class="line">    }</div><div class="line">}</div></div><!-- fragment --> base [in] Pointer to KeyScan instance register area. mask [in] The mask with the OR of the interrupt source to be accepted. See \ group_keyscan_intr_mask_macro for the set of constants. </dd></dl>

</div>
</div>
<a id="ga7f5d1d2ed0c2b0098be1b8a7e334a901"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7f5d1d2ed0c2b0098be1b8a7e334a901">&#9670;&nbsp;</a></span>Cy_Keyscan_GetInterruptMask()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> Cy_Keyscan_GetInterruptMask </td>
          <td>(</td>
          <td class="paramtype">MXKEYSCAN_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t *&#160;</td>
          <td class="paramname"><em>mask</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Return interrupt mask setting. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>[in] Pointer to KeyScan instance register area. </td></tr>
    <tr><td class="paramname">mask</td><td>[out] The mask with the OR of the interrupt source which is masked. See <a class="el" href="group__group__keyscan__intr__mask__macro.html">KeyScan ALL interrupt mask definition</a> for the set of constants.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">Refer</td><td><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line"><span class="comment">/*</span></div><div class="line"><span class="comment"> ** Applications have to call Cy_Keyscan_Interrupt_Handler function from keyscan interrupt handler.</span></div><div class="line"><span class="comment"> ** Applications will be notified of any key events through the registered callback.</span></div><div class="line"><span class="comment"> ** Applications have to read the events in the callback function by calling Cy_Keyscan_GetNextEvent function in a loop till</span></div><div class="line"><span class="comment"> ** the return value is CY_KEYSCAN_EVENT_NONE.</span></div><div class="line"><span class="comment"> */</span></div><div class="line"><span class="keywordtype">void</span> keyscan_intHandler(<span class="keywordtype">void</span>)</div><div class="line">{</div><div class="line">    <a class="code" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> status;</div><div class="line">    uint32_t int_status;</div><div class="line">    <a class="code" href="group__group__keyscan__functions.html#gaafe690c5c55275e002675833358efc71">Cy_Keyscan_GetInterruptMaskedStatus</a>(MXKEYSCAN, &amp;int_status);</div><div class="line">    <span class="keywordflow">if</span>(0UL != (<a class="code" href="group__group__keyscan__intr__mask__macro.html#gabaf6c48f537039c42f3cd554fbead9ec">MXKEYSCAN_INTR_FIFO_THRESH_DONE</a> &amp; int_status))</div><div class="line">    {</div><div class="line">       status = <a class="code" href="group__group__keyscan__functions.html#gac0949bdeeec1076c259f327b5be4766c">Cy_Keyscan_Interrupt_Handler</a>(MXKEYSCAN, &amp;context);</div><div class="line">       <span class="keywordflow">if</span>(<a class="code" href="group__group__keyscan__enums.html#gga63db7add05b9f273c43aac216af16d4bad0ab5c35021d0615b1063492c23e1841">CY_KEYSCAN_SUCCESS</a> != status)</div><div class="line">       {</div><div class="line">            <span class="comment">// Keyscan interrupt handler failed </span></div><div class="line">       }</div><div class="line">    }</div><div class="line">    <span class="keywordflow">else</span></div><div class="line">    {</div><div class="line">        <a class="code" href="group__group__keyscan__functions.html#gab0697bc91ec30ec625080f2e36d8f76f">Cy_Keyscan_ClearInterrupt</a>(MXKEYSCAN, <a class="code" href="group__group__keyscan__intr__mask__macro.html#ga203e1a386d3c094322980c053cb4d5f9">MXKEYSCAN_INTR_KEY_EDGE_DONE</a>);</div><div class="line">    }</div><div class="line"></div><div class="line">}</div><div class="line"></div><div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> key_detected_callback(<span class="keywordtype">void</span>)</div><div class="line">{</div><div class="line">    <a class="code" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> status;</div><div class="line">    <a class="code" href="structcy__stc__key__event.html">cy_stc_key_event</a> kevent;</div><div class="line">    uint8_t keyCode, scanCycle, upDownFlag;</div><div class="line">    <span class="keywordtype">bool</span> events_pending;</div><div class="line">    <a class="code" href="group__group__keyscan__functions.html#ga2d9772cf7639507551f8719b61ee149a">Cy_Keyscan_EventsPending</a>(MXKEYSCAN, &amp;events_pending, &amp;context);</div><div class="line">    <span class="keywordflow">while</span> (events_pending)</div><div class="line">    {</div><div class="line">        status = <a class="code" href="group__group__keyscan__functions.html#ga112645238ff1a8fbe2babf37ececa928">Cy_Keyscan_GetNextEvent</a>(MXKEYSCAN, &amp;kevent, &amp;context);</div><div class="line">        <span class="keywordflow">if</span>(status != <a class="code" href="group__group__keyscan__enums.html#gga63db7add05b9f273c43aac216af16d4bad0ab5c35021d0615b1063492c23e1841">CY_KEYSCAN_SUCCESS</a>)</div><div class="line">        {</div><div class="line">            <span class="comment">// Keyscan get next event failed </span></div><div class="line">        }</div><div class="line">        <span class="comment">/* Check value of keycode for the corresponding key being pressed</span></div><div class="line"><span class="comment">           Keycode is calculated as ((no of rows * column num) + row num) */</span></div><div class="line">        keyCode = kevent.<a class="code" href="structcy__stc__key__event.html#a380b32448606828dab08e812bc3177f7">keyCode</a>;</div><div class="line">        scanCycle = kevent.<a class="code" href="structcy__stc__key__event.html#a4dfca39b0e4b645e4f4aa3c4ba346dc2">scanCycleFlag</a>;</div><div class="line">        upDownFlag = kevent.<a class="code" href="structcy__stc__key__event.html#a09f7d1c2aeb58ae2e29556a7933c7c79">upDownFlag</a>;</div><div class="line"></div><div class="line">        <span class="keywordflow">if</span>(keyCode == <a class="code" href="group__group__keyscan__enums.html#gga3e52483d024a86b66d31e61c83ed4751a5226620ddbc8a578dd0de50c7e6f4728">KEYSCAN_KEYCODE_ROLLOVER</a>)</div><div class="line">        {</div><div class="line">            <span class="comment">// ROLLOVER KEY DETECTED</span></div><div class="line">        }</div><div class="line">        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(keyCode == <a class="code" href="group__group__keyscan__enums.html#gga3e52483d024a86b66d31e61c83ed4751a2ef0b0d0f231e64c1eff96564dcf1d9a">KEYSCAN_KEYCODE_END_OF_SCAN_CYCLE</a>)</div><div class="line">        {</div><div class="line">            <span class="comment">// End of Scan Cycle event. Added by driver when an event is occurred in different scan cycle.</span></div><div class="line">            <a class="code" href="group__group__keyscan__functions.html#ga2d9772cf7639507551f8719b61ee149a">Cy_Keyscan_EventsPending</a>(MXKEYSCAN, &amp;events_pending, &amp;context);</div><div class="line">            <span class="keywordflow">continue</span>;</div><div class="line">        }</div><div class="line">        <a class="code" href="group__group__keyscan__functions.html#ga2d9772cf7639507551f8719b61ee149a">Cy_Keyscan_EventsPending</a>(MXKEYSCAN, &amp;events_pending, &amp;context);</div><div class="line">        (void)keyCode;</div><div class="line">        (void)scanCycle;</div><div class="line">        (void)upDownFlag;</div><div class="line">    }</div><div class="line">}</div></div><!-- fragment --> base [in] Pointer to KeyScan instance register area. mask [out] The mask with the OR of the interrupt source which is masked. See \ group_keyscan_intr_mask_macro for the set of constants. </dd></dl>

</div>
</div>
<a id="gaafe690c5c55275e002675833358efc71"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaafe690c5c55275e002675833358efc71">&#9670;&nbsp;</a></span>Cy_Keyscan_GetInterruptMaskedStatus()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> Cy_Keyscan_GetInterruptMaskedStatus </td>
          <td>(</td>
          <td class="paramtype">MXKEYSCAN_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t *&#160;</td>
          <td class="paramname"><em>status</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Return interrupt masked status. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>[in] Pointer to KeyScan instance register area. </td></tr>
    <tr><td class="paramname">status</td><td>[out] The mask with the OR of the interrupt source which occurs. See <a class="el" href="group__group__keyscan__intr__mask__macro.html">KeyScan ALL interrupt mask definition</a> for the set of constants.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">Refer</td><td><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line"><span class="comment">/*</span></div><div class="line"><span class="comment"> ** Applications have to call Cy_Keyscan_Interrupt_Handler function from keyscan interrupt handler.</span></div><div class="line"><span class="comment"> ** Applications will be notified of any key events through the registered callback.</span></div><div class="line"><span class="comment"> ** Applications have to read the events in the callback function by calling Cy_Keyscan_GetNextEvent function in a loop till</span></div><div class="line"><span class="comment"> ** the return value is CY_KEYSCAN_EVENT_NONE.</span></div><div class="line"><span class="comment"> */</span></div><div class="line"><span class="keywordtype">void</span> keyscan_intHandler(<span class="keywordtype">void</span>)</div><div class="line">{</div><div class="line">    <a class="code" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> status;</div><div class="line">    uint32_t int_status;</div><div class="line">    <a class="code" href="group__group__keyscan__functions.html#gaafe690c5c55275e002675833358efc71">Cy_Keyscan_GetInterruptMaskedStatus</a>(MXKEYSCAN, &amp;int_status);</div><div class="line">    <span class="keywordflow">if</span>(0UL != (<a class="code" href="group__group__keyscan__intr__mask__macro.html#gabaf6c48f537039c42f3cd554fbead9ec">MXKEYSCAN_INTR_FIFO_THRESH_DONE</a> &amp; int_status))</div><div class="line">    {</div><div class="line">       status = <a class="code" href="group__group__keyscan__functions.html#gac0949bdeeec1076c259f327b5be4766c">Cy_Keyscan_Interrupt_Handler</a>(MXKEYSCAN, &amp;context);</div><div class="line">       <span class="keywordflow">if</span>(<a class="code" href="group__group__keyscan__enums.html#gga63db7add05b9f273c43aac216af16d4bad0ab5c35021d0615b1063492c23e1841">CY_KEYSCAN_SUCCESS</a> != status)</div><div class="line">       {</div><div class="line">            <span class="comment">// Keyscan interrupt handler failed </span></div><div class="line">       }</div><div class="line">    }</div><div class="line">    <span class="keywordflow">else</span></div><div class="line">    {</div><div class="line">        <a class="code" href="group__group__keyscan__functions.html#gab0697bc91ec30ec625080f2e36d8f76f">Cy_Keyscan_ClearInterrupt</a>(MXKEYSCAN, <a class="code" href="group__group__keyscan__intr__mask__macro.html#ga203e1a386d3c094322980c053cb4d5f9">MXKEYSCAN_INTR_KEY_EDGE_DONE</a>);</div><div class="line">    }</div><div class="line"></div><div class="line">}</div><div class="line"></div><div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> key_detected_callback(<span class="keywordtype">void</span>)</div><div class="line">{</div><div class="line">    <a class="code" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> status;</div><div class="line">    <a class="code" href="structcy__stc__key__event.html">cy_stc_key_event</a> kevent;</div><div class="line">    uint8_t keyCode, scanCycle, upDownFlag;</div><div class="line">    <span class="keywordtype">bool</span> events_pending;</div><div class="line">    <a class="code" href="group__group__keyscan__functions.html#ga2d9772cf7639507551f8719b61ee149a">Cy_Keyscan_EventsPending</a>(MXKEYSCAN, &amp;events_pending, &amp;context);</div><div class="line">    <span class="keywordflow">while</span> (events_pending)</div><div class="line">    {</div><div class="line">        status = <a class="code" href="group__group__keyscan__functions.html#ga112645238ff1a8fbe2babf37ececa928">Cy_Keyscan_GetNextEvent</a>(MXKEYSCAN, &amp;kevent, &amp;context);</div><div class="line">        <span class="keywordflow">if</span>(status != <a class="code" href="group__group__keyscan__enums.html#gga63db7add05b9f273c43aac216af16d4bad0ab5c35021d0615b1063492c23e1841">CY_KEYSCAN_SUCCESS</a>)</div><div class="line">        {</div><div class="line">            <span class="comment">// Keyscan get next event failed </span></div><div class="line">        }</div><div class="line">        <span class="comment">/* Check value of keycode for the corresponding key being pressed</span></div><div class="line"><span class="comment">           Keycode is calculated as ((no of rows * column num) + row num) */</span></div><div class="line">        keyCode = kevent.<a class="code" href="structcy__stc__key__event.html#a380b32448606828dab08e812bc3177f7">keyCode</a>;</div><div class="line">        scanCycle = kevent.<a class="code" href="structcy__stc__key__event.html#a4dfca39b0e4b645e4f4aa3c4ba346dc2">scanCycleFlag</a>;</div><div class="line">        upDownFlag = kevent.<a class="code" href="structcy__stc__key__event.html#a09f7d1c2aeb58ae2e29556a7933c7c79">upDownFlag</a>;</div><div class="line"></div><div class="line">        <span class="keywordflow">if</span>(keyCode == <a class="code" href="group__group__keyscan__enums.html#gga3e52483d024a86b66d31e61c83ed4751a5226620ddbc8a578dd0de50c7e6f4728">KEYSCAN_KEYCODE_ROLLOVER</a>)</div><div class="line">        {</div><div class="line">            <span class="comment">// ROLLOVER KEY DETECTED</span></div><div class="line">        }</div><div class="line">        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(keyCode == <a class="code" href="group__group__keyscan__enums.html#gga3e52483d024a86b66d31e61c83ed4751a2ef0b0d0f231e64c1eff96564dcf1d9a">KEYSCAN_KEYCODE_END_OF_SCAN_CYCLE</a>)</div><div class="line">        {</div><div class="line">            <span class="comment">// End of Scan Cycle event. Added by driver when an event is occurred in different scan cycle.</span></div><div class="line">            <a class="code" href="group__group__keyscan__functions.html#ga2d9772cf7639507551f8719b61ee149a">Cy_Keyscan_EventsPending</a>(MXKEYSCAN, &amp;events_pending, &amp;context);</div><div class="line">            <span class="keywordflow">continue</span>;</div><div class="line">        }</div><div class="line">        <a class="code" href="group__group__keyscan__functions.html#ga2d9772cf7639507551f8719b61ee149a">Cy_Keyscan_EventsPending</a>(MXKEYSCAN, &amp;events_pending, &amp;context);</div><div class="line">        (void)keyCode;</div><div class="line">        (void)scanCycle;</div><div class="line">        (void)upDownFlag;</div><div class="line">    }</div><div class="line">}</div></div><!-- fragment --> base [in] Pointer to KeyScan instance register area. status [out] The mask with the OR of the interrupt source which occurs. See \ group_keyscan_intr_mask_macro for the set of constants. </dd></dl>

</div>
</div>
<a id="ga0d19ff8bef185f26261346665243b72e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga0d19ff8bef185f26261346665243b72e">&#9670;&nbsp;</a></span>Cy_Keyscan_GetInterruptStatus()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> Cy_Keyscan_GetInterruptStatus </td>
          <td>(</td>
          <td class="paramtype">MXKEYSCAN_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t *&#160;</td>
          <td class="paramname"><em>status</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Return interrupt raw status. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>[in] Pointer to Keyscan instance register area. </td></tr>
    <tr><td class="paramname">status</td><td>[out] The mask with the OR of the interrupt source which occurs. See <a class="el" href="group__group__keyscan__intr__mask__macro.html">KeyScan ALL interrupt mask definition</a> for the set of constants.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">Refer</td><td><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line"><span class="comment">/*</span></div><div class="line"><span class="comment"> ** Applications have to call Cy_Keyscan_Interrupt_Handler function from keyscan interrupt handler.</span></div><div class="line"><span class="comment"> ** Applications will be notified of any key events through the registered callback.</span></div><div class="line"><span class="comment"> ** Applications have to read the events in the callback function by calling Cy_Keyscan_GetNextEvent function in a loop till</span></div><div class="line"><span class="comment"> ** the return value is CY_KEYSCAN_EVENT_NONE.</span></div><div class="line"><span class="comment"> */</span></div><div class="line"><span class="keywordtype">void</span> keyscan_intHandler(<span class="keywordtype">void</span>)</div><div class="line">{</div><div class="line">    <a class="code" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> status;</div><div class="line">    uint32_t int_status;</div><div class="line">    <a class="code" href="group__group__keyscan__functions.html#gaafe690c5c55275e002675833358efc71">Cy_Keyscan_GetInterruptMaskedStatus</a>(MXKEYSCAN, &amp;int_status);</div><div class="line">    <span class="keywordflow">if</span>(0UL != (<a class="code" href="group__group__keyscan__intr__mask__macro.html#gabaf6c48f537039c42f3cd554fbead9ec">MXKEYSCAN_INTR_FIFO_THRESH_DONE</a> &amp; int_status))</div><div class="line">    {</div><div class="line">       status = <a class="code" href="group__group__keyscan__functions.html#gac0949bdeeec1076c259f327b5be4766c">Cy_Keyscan_Interrupt_Handler</a>(MXKEYSCAN, &amp;context);</div><div class="line">       <span class="keywordflow">if</span>(<a class="code" href="group__group__keyscan__enums.html#gga63db7add05b9f273c43aac216af16d4bad0ab5c35021d0615b1063492c23e1841">CY_KEYSCAN_SUCCESS</a> != status)</div><div class="line">       {</div><div class="line">            <span class="comment">// Keyscan interrupt handler failed </span></div><div class="line">       }</div><div class="line">    }</div><div class="line">    <span class="keywordflow">else</span></div><div class="line">    {</div><div class="line">        <a class="code" href="group__group__keyscan__functions.html#gab0697bc91ec30ec625080f2e36d8f76f">Cy_Keyscan_ClearInterrupt</a>(MXKEYSCAN, <a class="code" href="group__group__keyscan__intr__mask__macro.html#ga203e1a386d3c094322980c053cb4d5f9">MXKEYSCAN_INTR_KEY_EDGE_DONE</a>);</div><div class="line">    }</div><div class="line"></div><div class="line">}</div><div class="line"></div><div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> key_detected_callback(<span class="keywordtype">void</span>)</div><div class="line">{</div><div class="line">    <a class="code" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> status;</div><div class="line">    <a class="code" href="structcy__stc__key__event.html">cy_stc_key_event</a> kevent;</div><div class="line">    uint8_t keyCode, scanCycle, upDownFlag;</div><div class="line">    <span class="keywordtype">bool</span> events_pending;</div><div class="line">    <a class="code" href="group__group__keyscan__functions.html#ga2d9772cf7639507551f8719b61ee149a">Cy_Keyscan_EventsPending</a>(MXKEYSCAN, &amp;events_pending, &amp;context);</div><div class="line">    <span class="keywordflow">while</span> (events_pending)</div><div class="line">    {</div><div class="line">        status = <a class="code" href="group__group__keyscan__functions.html#ga112645238ff1a8fbe2babf37ececa928">Cy_Keyscan_GetNextEvent</a>(MXKEYSCAN, &amp;kevent, &amp;context);</div><div class="line">        <span class="keywordflow">if</span>(status != <a class="code" href="group__group__keyscan__enums.html#gga63db7add05b9f273c43aac216af16d4bad0ab5c35021d0615b1063492c23e1841">CY_KEYSCAN_SUCCESS</a>)</div><div class="line">        {</div><div class="line">            <span class="comment">// Keyscan get next event failed </span></div><div class="line">        }</div><div class="line">        <span class="comment">/* Check value of keycode for the corresponding key being pressed</span></div><div class="line"><span class="comment">           Keycode is calculated as ((no of rows * column num) + row num) */</span></div><div class="line">        keyCode = kevent.<a class="code" href="structcy__stc__key__event.html#a380b32448606828dab08e812bc3177f7">keyCode</a>;</div><div class="line">        scanCycle = kevent.<a class="code" href="structcy__stc__key__event.html#a4dfca39b0e4b645e4f4aa3c4ba346dc2">scanCycleFlag</a>;</div><div class="line">        upDownFlag = kevent.<a class="code" href="structcy__stc__key__event.html#a09f7d1c2aeb58ae2e29556a7933c7c79">upDownFlag</a>;</div><div class="line"></div><div class="line">        <span class="keywordflow">if</span>(keyCode == <a class="code" href="group__group__keyscan__enums.html#gga3e52483d024a86b66d31e61c83ed4751a5226620ddbc8a578dd0de50c7e6f4728">KEYSCAN_KEYCODE_ROLLOVER</a>)</div><div class="line">        {</div><div class="line">            <span class="comment">// ROLLOVER KEY DETECTED</span></div><div class="line">        }</div><div class="line">        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(keyCode == <a class="code" href="group__group__keyscan__enums.html#gga3e52483d024a86b66d31e61c83ed4751a2ef0b0d0f231e64c1eff96564dcf1d9a">KEYSCAN_KEYCODE_END_OF_SCAN_CYCLE</a>)</div><div class="line">        {</div><div class="line">            <span class="comment">// End of Scan Cycle event. Added by driver when an event is occurred in different scan cycle.</span></div><div class="line">            <a class="code" href="group__group__keyscan__functions.html#ga2d9772cf7639507551f8719b61ee149a">Cy_Keyscan_EventsPending</a>(MXKEYSCAN, &amp;events_pending, &amp;context);</div><div class="line">            <span class="keywordflow">continue</span>;</div><div class="line">        }</div><div class="line">        <a class="code" href="group__group__keyscan__functions.html#ga2d9772cf7639507551f8719b61ee149a">Cy_Keyscan_EventsPending</a>(MXKEYSCAN, &amp;events_pending, &amp;context);</div><div class="line">        (void)keyCode;</div><div class="line">        (void)scanCycle;</div><div class="line">        (void)upDownFlag;</div><div class="line">    }</div><div class="line">}</div></div><!-- fragment --> base [in] Pointer to Keyscan instance register area. status [out] The mask with the OR of the interrupt source which occurs. See \ group_keyscan_intr_mask_macro for the set of constants. </dd></dl>

</div>
</div>
<a id="gab0697bc91ec30ec625080f2e36d8f76f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab0697bc91ec30ec625080f2e36d8f76f">&#9670;&nbsp;</a></span>Cy_Keyscan_ClearInterrupt()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> Cy_Keyscan_ClearInterrupt </td>
          <td>(</td>
          <td class="paramtype">MXKEYSCAN_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>mask</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Clear interrupt status. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>[in] Pointer to Keyscan instance register area. </td></tr>
    <tr><td class="paramname">mask</td><td>[in] The mask with the OR of the interrupt source to be cleared. See <a class="el" href="group__group__keyscan__intr__mask__macro.html">KeyScan ALL interrupt mask definition</a> for the set of constants.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">Refer</td><td><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line"><span class="comment">/*</span></div><div class="line"><span class="comment"> ** Applications have to call Cy_Keyscan_Interrupt_Handler function from keyscan interrupt handler.</span></div><div class="line"><span class="comment"> ** Applications will be notified of any key events through the registered callback.</span></div><div class="line"><span class="comment"> ** Applications have to read the events in the callback function by calling Cy_Keyscan_GetNextEvent function in a loop till</span></div><div class="line"><span class="comment"> ** the return value is CY_KEYSCAN_EVENT_NONE.</span></div><div class="line"><span class="comment"> */</span></div><div class="line"><span class="keywordtype">void</span> keyscan_intHandler(<span class="keywordtype">void</span>)</div><div class="line">{</div><div class="line">    <a class="code" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> status;</div><div class="line">    uint32_t int_status;</div><div class="line">    <a class="code" href="group__group__keyscan__functions.html#gaafe690c5c55275e002675833358efc71">Cy_Keyscan_GetInterruptMaskedStatus</a>(MXKEYSCAN, &amp;int_status);</div><div class="line">    <span class="keywordflow">if</span>(0UL != (<a class="code" href="group__group__keyscan__intr__mask__macro.html#gabaf6c48f537039c42f3cd554fbead9ec">MXKEYSCAN_INTR_FIFO_THRESH_DONE</a> &amp; int_status))</div><div class="line">    {</div><div class="line">       status = <a class="code" href="group__group__keyscan__functions.html#gac0949bdeeec1076c259f327b5be4766c">Cy_Keyscan_Interrupt_Handler</a>(MXKEYSCAN, &amp;context);</div><div class="line">       <span class="keywordflow">if</span>(<a class="code" href="group__group__keyscan__enums.html#gga63db7add05b9f273c43aac216af16d4bad0ab5c35021d0615b1063492c23e1841">CY_KEYSCAN_SUCCESS</a> != status)</div><div class="line">       {</div><div class="line">            <span class="comment">// Keyscan interrupt handler failed </span></div><div class="line">       }</div><div class="line">    }</div><div class="line">    <span class="keywordflow">else</span></div><div class="line">    {</div><div class="line">        <a class="code" href="group__group__keyscan__functions.html#gab0697bc91ec30ec625080f2e36d8f76f">Cy_Keyscan_ClearInterrupt</a>(MXKEYSCAN, <a class="code" href="group__group__keyscan__intr__mask__macro.html#ga203e1a386d3c094322980c053cb4d5f9">MXKEYSCAN_INTR_KEY_EDGE_DONE</a>);</div><div class="line">    }</div><div class="line"></div><div class="line">}</div><div class="line"></div><div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> key_detected_callback(<span class="keywordtype">void</span>)</div><div class="line">{</div><div class="line">    <a class="code" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> status;</div><div class="line">    <a class="code" href="structcy__stc__key__event.html">cy_stc_key_event</a> kevent;</div><div class="line">    uint8_t keyCode, scanCycle, upDownFlag;</div><div class="line">    <span class="keywordtype">bool</span> events_pending;</div><div class="line">    <a class="code" href="group__group__keyscan__functions.html#ga2d9772cf7639507551f8719b61ee149a">Cy_Keyscan_EventsPending</a>(MXKEYSCAN, &amp;events_pending, &amp;context);</div><div class="line">    <span class="keywordflow">while</span> (events_pending)</div><div class="line">    {</div><div class="line">        status = <a class="code" href="group__group__keyscan__functions.html#ga112645238ff1a8fbe2babf37ececa928">Cy_Keyscan_GetNextEvent</a>(MXKEYSCAN, &amp;kevent, &amp;context);</div><div class="line">        <span class="keywordflow">if</span>(status != <a class="code" href="group__group__keyscan__enums.html#gga63db7add05b9f273c43aac216af16d4bad0ab5c35021d0615b1063492c23e1841">CY_KEYSCAN_SUCCESS</a>)</div><div class="line">        {</div><div class="line">            <span class="comment">// Keyscan get next event failed </span></div><div class="line">        }</div><div class="line">        <span class="comment">/* Check value of keycode for the corresponding key being pressed</span></div><div class="line"><span class="comment">           Keycode is calculated as ((no of rows * column num) + row num) */</span></div><div class="line">        keyCode = kevent.<a class="code" href="structcy__stc__key__event.html#a380b32448606828dab08e812bc3177f7">keyCode</a>;</div><div class="line">        scanCycle = kevent.<a class="code" href="structcy__stc__key__event.html#a4dfca39b0e4b645e4f4aa3c4ba346dc2">scanCycleFlag</a>;</div><div class="line">        upDownFlag = kevent.<a class="code" href="structcy__stc__key__event.html#a09f7d1c2aeb58ae2e29556a7933c7c79">upDownFlag</a>;</div><div class="line"></div><div class="line">        <span class="keywordflow">if</span>(keyCode == <a class="code" href="group__group__keyscan__enums.html#gga3e52483d024a86b66d31e61c83ed4751a5226620ddbc8a578dd0de50c7e6f4728">KEYSCAN_KEYCODE_ROLLOVER</a>)</div><div class="line">        {</div><div class="line">            <span class="comment">// ROLLOVER KEY DETECTED</span></div><div class="line">        }</div><div class="line">        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(keyCode == <a class="code" href="group__group__keyscan__enums.html#gga3e52483d024a86b66d31e61c83ed4751a2ef0b0d0f231e64c1eff96564dcf1d9a">KEYSCAN_KEYCODE_END_OF_SCAN_CYCLE</a>)</div><div class="line">        {</div><div class="line">            <span class="comment">// End of Scan Cycle event. Added by driver when an event is occurred in different scan cycle.</span></div><div class="line">            <a class="code" href="group__group__keyscan__functions.html#ga2d9772cf7639507551f8719b61ee149a">Cy_Keyscan_EventsPending</a>(MXKEYSCAN, &amp;events_pending, &amp;context);</div><div class="line">            <span class="keywordflow">continue</span>;</div><div class="line">        }</div><div class="line">        <a class="code" href="group__group__keyscan__functions.html#ga2d9772cf7639507551f8719b61ee149a">Cy_Keyscan_EventsPending</a>(MXKEYSCAN, &amp;events_pending, &amp;context);</div><div class="line">        (void)keyCode;</div><div class="line">        (void)scanCycle;</div><div class="line">        (void)upDownFlag;</div><div class="line">    }</div><div class="line">}</div></div><!-- fragment --> base [in] Pointer to Keyscan instance register area. mask [in] The mask with the OR of the interrupt source to be cleared. See \ group_keyscan_intr_mask_macro for the set of constants. </dd></dl>

</div>
</div>
<a id="gac0949bdeeec1076c259f327b5be4766c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac0949bdeeec1076c259f327b5be4766c">&#9670;&nbsp;</a></span>Cy_Keyscan_Interrupt_Handler()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> Cy_Keyscan_Interrupt_Handler </td>
          <td>(</td>
          <td class="paramtype">MXKEYSCAN_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__keyscan__context__t.html">cy_stc_keyscan_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Handler for keyscan interrupts. </p>
<p>Applications have to call this function from keyscan interrupt handler. After successfully reading from HW FIFO and writing to FW FIFO this function will notify application to read from the FW FIFO. Application has to call Cy_Keyscan_getNextEvent() in a loop till the return value is CY_KEYSCAN_EVENT_NONE</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>[in] Pointer to Keyscan instance register area. </td></tr>
    <tr><td class="paramname">context</td><td>[in] Pointer to the context.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">Refer</td><td><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line"><span class="comment">/*</span></div><div class="line"><span class="comment"> ** Applications have to call Cy_Keyscan_Interrupt_Handler function from keyscan interrupt handler.</span></div><div class="line"><span class="comment"> ** Applications will be notified of any key events through the registered callback.</span></div><div class="line"><span class="comment"> ** Applications have to read the events in the callback function by calling Cy_Keyscan_GetNextEvent function in a loop till</span></div><div class="line"><span class="comment"> ** the return value is CY_KEYSCAN_EVENT_NONE.</span></div><div class="line"><span class="comment"> */</span></div><div class="line"><span class="keywordtype">void</span> keyscan_intHandler(<span class="keywordtype">void</span>)</div><div class="line">{</div><div class="line">    <a class="code" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> status;</div><div class="line">    uint32_t int_status;</div><div class="line">    <a class="code" href="group__group__keyscan__functions.html#gaafe690c5c55275e002675833358efc71">Cy_Keyscan_GetInterruptMaskedStatus</a>(MXKEYSCAN, &amp;int_status);</div><div class="line">    <span class="keywordflow">if</span>(0UL != (<a class="code" href="group__group__keyscan__intr__mask__macro.html#gabaf6c48f537039c42f3cd554fbead9ec">MXKEYSCAN_INTR_FIFO_THRESH_DONE</a> &amp; int_status))</div><div class="line">    {</div><div class="line">       status = <a class="code" href="group__group__keyscan__functions.html#gac0949bdeeec1076c259f327b5be4766c">Cy_Keyscan_Interrupt_Handler</a>(MXKEYSCAN, &amp;context);</div><div class="line">       <span class="keywordflow">if</span>(<a class="code" href="group__group__keyscan__enums.html#gga63db7add05b9f273c43aac216af16d4bad0ab5c35021d0615b1063492c23e1841">CY_KEYSCAN_SUCCESS</a> != status)</div><div class="line">       {</div><div class="line">            <span class="comment">// Keyscan interrupt handler failed </span></div><div class="line">       }</div><div class="line">    }</div><div class="line">    <span class="keywordflow">else</span></div><div class="line">    {</div><div class="line">        <a class="code" href="group__group__keyscan__functions.html#gab0697bc91ec30ec625080f2e36d8f76f">Cy_Keyscan_ClearInterrupt</a>(MXKEYSCAN, <a class="code" href="group__group__keyscan__intr__mask__macro.html#ga203e1a386d3c094322980c053cb4d5f9">MXKEYSCAN_INTR_KEY_EDGE_DONE</a>);</div><div class="line">    }</div><div class="line"></div><div class="line">}</div><div class="line"></div><div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> key_detected_callback(<span class="keywordtype">void</span>)</div><div class="line">{</div><div class="line">    <a class="code" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> status;</div><div class="line">    <a class="code" href="structcy__stc__key__event.html">cy_stc_key_event</a> kevent;</div><div class="line">    uint8_t keyCode, scanCycle, upDownFlag;</div><div class="line">    <span class="keywordtype">bool</span> events_pending;</div><div class="line">    <a class="code" href="group__group__keyscan__functions.html#ga2d9772cf7639507551f8719b61ee149a">Cy_Keyscan_EventsPending</a>(MXKEYSCAN, &amp;events_pending, &amp;context);</div><div class="line">    <span class="keywordflow">while</span> (events_pending)</div><div class="line">    {</div><div class="line">        status = <a class="code" href="group__group__keyscan__functions.html#ga112645238ff1a8fbe2babf37ececa928">Cy_Keyscan_GetNextEvent</a>(MXKEYSCAN, &amp;kevent, &amp;context);</div><div class="line">        <span class="keywordflow">if</span>(status != <a class="code" href="group__group__keyscan__enums.html#gga63db7add05b9f273c43aac216af16d4bad0ab5c35021d0615b1063492c23e1841">CY_KEYSCAN_SUCCESS</a>)</div><div class="line">        {</div><div class="line">            <span class="comment">// Keyscan get next event failed </span></div><div class="line">        }</div><div class="line">        <span class="comment">/* Check value of keycode for the corresponding key being pressed</span></div><div class="line"><span class="comment">           Keycode is calculated as ((no of rows * column num) + row num) */</span></div><div class="line">        keyCode = kevent.<a class="code" href="structcy__stc__key__event.html#a380b32448606828dab08e812bc3177f7">keyCode</a>;</div><div class="line">        scanCycle = kevent.<a class="code" href="structcy__stc__key__event.html#a4dfca39b0e4b645e4f4aa3c4ba346dc2">scanCycleFlag</a>;</div><div class="line">        upDownFlag = kevent.<a class="code" href="structcy__stc__key__event.html#a09f7d1c2aeb58ae2e29556a7933c7c79">upDownFlag</a>;</div><div class="line"></div><div class="line">        <span class="keywordflow">if</span>(keyCode == <a class="code" href="group__group__keyscan__enums.html#gga3e52483d024a86b66d31e61c83ed4751a5226620ddbc8a578dd0de50c7e6f4728">KEYSCAN_KEYCODE_ROLLOVER</a>)</div><div class="line">        {</div><div class="line">            <span class="comment">// ROLLOVER KEY DETECTED</span></div><div class="line">        }</div><div class="line">        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(keyCode == <a class="code" href="group__group__keyscan__enums.html#gga3e52483d024a86b66d31e61c83ed4751a2ef0b0d0f231e64c1eff96564dcf1d9a">KEYSCAN_KEYCODE_END_OF_SCAN_CYCLE</a>)</div><div class="line">        {</div><div class="line">            <span class="comment">// End of Scan Cycle event. Added by driver when an event is occurred in different scan cycle.</span></div><div class="line">            <a class="code" href="group__group__keyscan__functions.html#ga2d9772cf7639507551f8719b61ee149a">Cy_Keyscan_EventsPending</a>(MXKEYSCAN, &amp;events_pending, &amp;context);</div><div class="line">            <span class="keywordflow">continue</span>;</div><div class="line">        }</div><div class="line">        <a class="code" href="group__group__keyscan__functions.html#ga2d9772cf7639507551f8719b61ee149a">Cy_Keyscan_EventsPending</a>(MXKEYSCAN, &amp;events_pending, &amp;context);</div><div class="line">        (void)keyCode;</div><div class="line">        (void)scanCycle;</div><div class="line">        (void)upDownFlag;</div><div class="line">    }</div><div class="line">}</div></div><!-- fragment --> Applications have to call this function from keyscan interrupt handler.</dd></dl>
<p>base [in] Pointer to Keyscan instance register area. context [in] Pointer to the context. </p>

</div>
</div>
<a id="ga8162b233f6c5454d08ff7edfd1ed7025"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga8162b233f6c5454d08ff7edfd1ed7025">&#9670;&nbsp;</a></span>Cy_Keyscan_FlushEvents()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> Cy_Keyscan_FlushEvents </td>
          <td>(</td>
          <td class="paramtype">MXKEYSCAN_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcy__stc__keyscan__context__t.html">cy_stc_keyscan_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Flush events from HW FIFO. </p>
<p>Flush the Fw FIFO also and it is equivalent to no key press events.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>[in] Pointer to Keyscan instance register area. </td></tr>
    <tr><td class="paramname">context</td><td>[in] Pointer to the context.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">Refer</td><td><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a></td></tr>
  </table>
  </dd>
</dl>
<p>Flush events from HW FIFO.</p>
<p>[in] context Pointer to the context. [in] base Pointer to KeyScan instance register area </p>

</div>
</div>
<a id="ga8019cb06088df4965c389a7a10cae05e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga8019cb06088df4965c389a7a10cae05e">&#9670;&nbsp;</a></span>Cy_Keyscan_EnableGhostDetection()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> Cy_Keyscan_EnableGhostDetection </td>
          <td>(</td>
          <td class="paramtype">MXKEYSCAN_Type *&#160;</td>
          <td class="paramname"><em>base</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Enables Ghost detection. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>[in] Pointer to Keyscan instance register area.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">Refer</td><td><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line">    <span class="keywordflow">if</span>(<a class="code" href="group__group__keyscan__enums.html#gga63db7add05b9f273c43aac216af16d4bad0ab5c35021d0615b1063492c23e1841">CY_KEYSCAN_SUCCESS</a> != <a class="code" href="group__group__keyscan__functions.html#ga8019cb06088df4965c389a7a10cae05e">Cy_Keyscan_EnableGhostDetection</a>(MXKEYSCAN))</div><div class="line">    {</div><div class="line">        <span class="comment">/* Insert error handling */</span></div><div class="line">    }</div></div><!-- fragment --> base [in] Pointer to Keyscan instance register area. </dd></dl>

</div>
</div>
<a id="ga84e9a47942e53502616d6c87fdd2035c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga84e9a47942e53502616d6c87fdd2035c">&#9670;&nbsp;</a></span>Cy_Keyscan_DisableGhostDetection()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> Cy_Keyscan_DisableGhostDetection </td>
          <td>(</td>
          <td class="paramtype">MXKEYSCAN_Type *&#160;</td>
          <td class="paramname"><em>base</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Disables Ghost detection. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>[in] Pointer to Keyscan instance register area.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">Refer</td><td><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line">    <span class="keywordflow">if</span>(<a class="code" href="group__group__keyscan__enums.html#gga63db7add05b9f273c43aac216af16d4bad0ab5c35021d0615b1063492c23e1841">CY_KEYSCAN_SUCCESS</a> != <a class="code" href="group__group__keyscan__functions.html#ga84e9a47942e53502616d6c87fdd2035c">Cy_Keyscan_DisableGhostDetection</a>(MXKEYSCAN))</div><div class="line">    {</div><div class="line">        <span class="comment">/* Insert error handling */</span></div><div class="line">    }</div></div><!-- fragment --> base [in] Pointer to Keyscan instance register area. </dd></dl>

</div>
</div>
<a id="gadd708d5c9a895b841deef7f473c41276"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gadd708d5c9a895b841deef7f473c41276">&#9670;&nbsp;</a></span>Cy_Keyscan_EnableClockStayOn()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> Cy_Keyscan_EnableClockStayOn </td>
          <td>(</td>
          <td class="paramtype">MXKEYSCAN_Type *&#160;</td>
          <td class="paramname"><em>base</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Enables Clock Stay On Clock to the IP is always enabled. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>[in] Pointer to Keyscan instance register area.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">Refer</td><td><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line">    <span class="keywordflow">if</span>(<a class="code" href="group__group__keyscan__enums.html#gga63db7add05b9f273c43aac216af16d4bad0ab5c35021d0615b1063492c23e1841">CY_KEYSCAN_SUCCESS</a> != <a class="code" href="group__group__keyscan__functions.html#gadd708d5c9a895b841deef7f473c41276">Cy_Keyscan_EnableClockStayOn</a>(MXKEYSCAN))</div><div class="line">    {</div><div class="line">        <span class="comment">/* Insert error handling */</span></div><div class="line">    }</div></div><!-- fragment --> base [in] Pointer to Keyscan instance register area. </dd></dl>

</div>
</div>
<a id="ga61f8551b923bc07a0a0646865b94d3cf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga61f8551b923bc07a0a0646865b94d3cf">&#9670;&nbsp;</a></span>Cy_Keyscan_DisableClockStayOn()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a> Cy_Keyscan_DisableClockStayOn </td>
          <td>(</td>
          <td class="paramtype">MXKEYSCAN_Type *&#160;</td>
          <td class="paramname"><em>base</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Disables Clock Stay On When there is no activity detected the clock to the Keyscan is gated off. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>[in] Pointer to Keyscan instance register area.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">Refer</td><td><a class="el" href="group__group__keyscan__enums.html#ga63db7add05b9f273c43aac216af16d4b">cy_en_ks_status_t</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line">    <span class="keywordflow">if</span>(<a class="code" href="group__group__keyscan__enums.html#gga63db7add05b9f273c43aac216af16d4bad0ab5c35021d0615b1063492c23e1841">CY_KEYSCAN_SUCCESS</a> != <a class="code" href="group__group__keyscan__functions.html#ga61f8551b923bc07a0a0646865b94d3cf">Cy_Keyscan_DisableClockStayOn</a>(MXKEYSCAN))</div><div class="line">    {</div><div class="line">        <span class="comment">/* Insert error handling */</span></div><div class="line">    }</div></div><!-- fragment --> Disables Clock Stay On When there is no activity detected the clock to the Keyscan is gated off.</dd></dl>
<p>base [in] Pointer to Keyscan instance register area. </p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>MTB CAT1 Peripheral driver library</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
